﻿package mortal.common.tools
{
    import com.gengine.core.*;
    import com.gengine.debug.*;
    import com.gengine.global.*;
    import mortal.common.global.*;
    import mortal.component.window.*;
    import mortal.game.manager.*;

    public class DebugUtil extends Object
    {
        private static var _commandArray:Array = ["c##showDebug", "c##showRightMenu", "c##closeDebug", "c##hideDebug", "c##showAll", "c##showUITool", "c##openFightTest", "c##closeFightTest", "c##showGuildCalculate"];

        public function DebugUtil()
        {
            return;
        }// end function

        public static function isDebugCommand(param1:String) : Boolean
        {
            var _loc_2:Boolean = false;
            var _loc_3:String = null;
            var _loc_4:int = 0;
            while (_loc_4 < _commandArray.length)
            {
                
                _loc_3 = _commandArray[_loc_4] as String;
                if (param1 == _loc_3)
                {
                    _loc_2 = true;
                    break;
                }
                _loc_4++;
            }
            return _loc_2;
        }// end function

        public static function set isDebug(param1:Boolean) : void
        {
            if (param1)
            {
                Log.openAll();
                Global.isDebugModle = true;
                FPS.instance.show();
                DebugWindow.instance.show();
            }
            else
            {
                Log.closeAll();
                Global.isDebugModle = false;
                FPS.instance.hide();
                DebugWindow.instance.hide();
            }
            return;
        }// end function

        public static function runDebugCommand(param1:String) : void
        {
            if (isDebugCommand(param1))
            {
                switch(param1)
                {
                    case "c##showDebug":
                    {
                        isDebug = true;
                        break;
                    }
                    case "c##showRightMenu":
                    {
                        MouseRightClickManager.instance.stop();
                        break;
                    }
                    case "c##closeDebug":
                    case "c##hideDebug":
                    {
                        isDebug = false;
                        break;
                    }
                    case "c##showAll":
                    {
                        if (ParamsConst.instance.isShowError)
                        {
                        }
                        break;
                    }
                    case "c##openFightTest":
                    {
                        FrameUtil.isOpen = true;
                        MsgManager.showRollTipsMsg("成功开启团战优化测试1");
                        break;
                    }
                    case "c##closeFightTest":
                    {
                        FrameUtil.isOpen = false;
                        MsgManager.showRollTipsMsg("成功关闭团战优化测试1");
                        break;
                    }
                    default:
                    {
                        break;
                    }
                }
            }
            return;
        }// end function

    }
}
